package server.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import server.model.entity.BlanceRecord;

import java.util.List;

/**
 * 创建人:    xvzhe
 * 创建时间:
 * 修改时间:
 * 版本:      v1.0
 */
public interface BlanceRecordDao extends JpaRepository<BlanceRecord, String> {
    List<BlanceRecord> findByUserIdAndType(String userId, BlanceRecord.Type type);

    @Modifying
    @Query(value = "select * from blance_record where user_id = ?1 and (`type` = 'ONE' or " +
            "`type`= 'TWO' or `type`='THREE') ", nativeQuery = true)
    List<BlanceRecord> findByUserIdAndTO(String userId);
}
